
function wavelength_meters(freq as double) as double
	return 300 / freq
end function

function wavelength_feet(freq as double) as double
	return (936 / freq)
end function

sub Pause
dim msg as string
	color 15,0
	print "-=:[Press ENTER to continue!]:=-";
	line input msg
	cls
end sub

Sub ShowDiPole
Dim Freq as Double
Dim pole as double

	color 14,0
	cls
	input "Frequency";freq
	color 11,0
	cls
	pole = int(wavelength_feet(freq) * 1200) / 100
	Color 11,0
	print "For a Di-Pole ressonant on frequency of ";
	color 15,1
	print using "###.###";freq;
	color 11,0 : print
	print "You will need 2 pieces of wire, each "
	color 15,2
	print using "#####.###";pole;
	color 11,0
	print " inches [in] or ";
	color 15,3
	print using "#####.##";(int(pole / 12 * 100)/100);
	color 11,0
	print " feet [ft]."
	print "Total Wire for this project is: ";
	print using "####.###";(int(pole * 200 / 12)/100);
	print " feet [ft] or ";
	print using "####.###";(int(pole * 200)/100);
	print " inches [in]."
	pause
End Sub

Sub ShowGroundPlane
Dim Freq as double
Dim st as double
Dim rd as double

	cls
	input "Frequency";freq
	color 11,0
	cls
	print "For a Ground Plane Antenna ressonant on frequency ";
	print using "####.####";freq
	print "(1/4 wave)"
	st = int((wavelength_feet(freq) / 4) * 1200) / 100
	rd = int(st * 105) / 100
	print "Your stinger will be ";st;" inches [in]"
	print "Your Radials will be ";rd;" inches [in]"
	print "Total Wire: ";
	print using "###.###";(st + (4 * rd)); 
	print " inches [in]"
        print "            ";
	print using "###.#";((st + (4 * rd)) / 12); 
	print " feet [ft]"
	if (st > (12 * 4)) Then
	  print "Warning, this lenght is hard to deal with for wire,"
       	  print "Recommended using pipe instead of wire.  Just use "
	  print "The same length."
 	end if
	Pause
end sub

Sub ShowWavelength
dim Freq as double

	cls
	color 10,0
	input "Frequency"; Freq
	color 11,0
	print Freq;" is:"
	print wavelength_meters(freq); " Meters [m]"
	print int(wavelength_meters(freq) * 100); " Centimeters [cm]"
	print wavelength_feet(freq);" Feet [ft]"
	print int(wavelength_feet(freq) * 12);" Inches [in]"
	print
	pause
end sub

Sub MainMenu
Dim Done as integer
Dim ln as string

	Done = 0
	While (Done = 0)
	  cls
	  color 14,0
	  print "Ham Man Main Menu"
	  print "================="
	  print "1. Wavelength of Frequency"
	  print "2. Ground Plane"
	  print "3. Di-Pole"
	  print "Q. Exit"
	  input "Choice: ";ln
	  ln = ucase(ln)
	  Select case Ln 
               case "1" : showWavelength
	       case "2" : showGroundPlane
	       case "3" : ShowDiPole
	       case "Q" : done = -1
	  end select	
	wend
end sub

	MainMenu
